package hn.cch.spring.aop.aspect;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class ExecutionTarget0 {

    private static final Logger logger = LoggerFactory.getLogger(ExecutionTarget0.class);

    public ExecutionTarget0(){
        logger.debug("ExecutionProxy0");
    }

    @Autowired
    public void setExecutionProxy1(ExecutionTarget1 executionTarget1){
        logger.debug("setExecutionProxy1:{}", executionTarget1.getClass());
    }

    @PostConstruct  // 构造函数之后执行
    public void postConstruct() {
        logger.debug("ExecutionProxy0 postConstruct");
    }

    public String method(String string) {
        String result = string;
        result += string.toLowerCase();
        return result;
    }

    public String around(String string) {
        logger.debug("around");
        String result = string;
        result += string.toLowerCase();
        return result;
    }

}
